﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title id='Description'>In this example, the first Grid column is pinned and will be always visible while scrolling.</title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> 
    <script type="text/javascript" src="../../scripts/gettheme.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var theme = getTheme();

            var url = "../sampledata/products.xml";

            // prepare the data
            var source =
            {
                datatype: "xml",
                datafields: [
                    { name: 'ProductName' },
                    { name: 'QuantityPerUnit' },
                    { name: 'UnitPrice', type: 'float' },
                    { name: 'UnitsInStock', type: 'float' },
                    { name: 'UnitsOnOrder', type: 'float' },
                    { name: 'ReorderLevel', type: 'float' },
                    { name: 'CategoryID', type: 'int' }
               ],
                root: "Products",
                record: "Product",
                id: 'ProductID',
                url: url
            };

            var categories = {};
            var categoriesurl = '../sampledata/categories.xml';

            $.ajax({
                async: false,
                url: categoriesurl,
                success: function (data, status, xhr) {
                    categories = $("Category", data);
                }
            });

            $("#jqxgrid").jqxGrid(
            {
                width: 670,
                source: source,
                theme: theme,
                sortable: true,
                pageable: true,
                autoheight: true,
                columns: [
                  { text: 'Product Name', datafield: 'ProductName', width: 250, pinned: true },
                  { text: 'Category', datafield: 'CategoryID', width: 80, cellsalign: 'right' },
                  { text: 'Quantity Per Unit', datafield: 'QuantityPerUnit', width: 200, cellsalign: 'right' },
                  { text: 'Unit Price', datafield: 'UnitPrice', width: 100, cellsformat: 'c2', cellsalign: 'right' },
                  { text: 'Units On Order', datafield: 'UnitsOnOrder', width: 110, cellsalign: 'right' },
                  { text: 'Reorder Level', datafield: 'ReorderLevel', width: 100, cellsalign: 'right' }
               ]
            });
        });
    </script>
</head>
<body class='default'>
    <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
        <div id="jqxgrid">
        </div>
    </div>
</body>
</html>
